FROM eclipse-temurin:17-jdk-jammy

ENV TZ=Asia/Shanghai

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN set -o errexit -o nounset \
    && apt-get update \
    && apt-get install --yes --no-install-recommends \
        unzip \
        wget \
        \
        bzr \
        git \
        git-lfs \
        mercurial \
        openssh-client \
        subversion \
    && rm --recursive --force /var/lib/apt/lists/* \
    \
    && echo "Testing VCSes" \
    && which bzr \
    && which git \
    && which git-lfs \
    && which hg \
    && which svn

RUN set -o errexit -o nounset \
            && git clone https://gitee.com/zgc27wo/simple-holiday.git

WORKDIR simple-holiday

RUN set -o errexit -o nounset \
            && chmod 744 gradlew \
            && ./gradlew build

WORKDIR build/libs

EXPOSE 8881

ENTRYPOINT ["java", "-jar", "SimpleHoliday-0.0.1-SNAPSHOT.jar"]